import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";


//假期设置列表头部
export const getSetHeadApi = (params: FormData) => {
    return http.get(PORT1+`/goods-config/settings/colors/field`, params, { cancel: false,loading: false  });
};
//假期设置列表
export const getSetListApi = (params: FormData) => {
    return http.post(PORT1+`/goods-config/settings/colors/list?get_auth=1&auth_name=qifaColor`, params,  { cancel: false,loading: false  });
};
//新增假期类型
export const saveCreateSet = (params: FormData) => {
    return http.post(PORT1+`/goods-config/settings/colors/save`, params, { cancel: false });
};
//修改假期类型
export const saveEditSet = (params: FormData) => {
    return http.post(PORT1+`/goods-config/settings/colors/save`, params, { cancel: false });
};

//删除假期类型
export const delSet = (params: FormData) => {
    return http.get(PORT1+`/goods-config/settings/colors/delete`, params, { cancel: false });
};



// 上传色卡
export const uploadFiles = (
    data: FormData,
    onProgress?: (progressEvt: UploadProgressEvent) => void
  ) =>
    http.post(`${PORT1}/goods-config/settings/colors/upload`, data, {
      headers: { "Content-Type": "multipart/form-data" },
      onUploadProgress: (evt: any) => {
        const progressEvt = evt as UploadProgressEvent;
        progressEvt.percent = evt.total > 0 ? (evt.loaded / evt.total) * 100 : 0;
        onProgress?.(progressEvt);
      },
      loading: false,
      cancel: false
    });
  